import { defHttp } from '/@/utils/http/axios';
import {
  CreateDept,
  DeptListGetResultModel,
  DeptListItem,
  UpdateDept,
} from '/@/api/sys/model/deptModel';

enum Api {
  DeptList = '/system/dept/getDeptList',
  CreateDept = '/system/dept/createDept',
  UpdateDept = '/system/dept/updateDept',
  DeleteDept = '/system/dept/deleteDept',
}

export const getDeptList = (params?: DeptListItem) =>
  defHttp.get<DeptListGetResultModel>({ url: Api.DeptList, params });

export const createDept = (params?: CreateDept) =>
  defHttp.post<DeptListGetResultModel>({ url: Api.CreateDept, params });

export const updateDept = (params?: UpdateDept) =>
  defHttp.post<DeptListGetResultModel>({ url: Api.UpdateDept, params });

export const deleteDept = (deptId: number) =>
  defHttp.get({ url: Api.DeleteDept, params: { deptId } });
